from django.conf.urls.defaults import *
from hominin.publications.models import Book, Paper, Author

author_dict = {
	'queryset': Author.objects.all(),
}

book_dict = {
	'queryset': Book.objects.all(),
}

paper_dict = {
	'queryset': Paper.objects.all(),
}


urlpatterns = patterns('',
	(r'^authors/$', 'django.views.generic.list_detail.object_list', author_dict),
	(r'^authors/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', author_dict),
	(r'^authors/(?P<slug>[-\w]+)/$', 'django.views.generic.list_detail.object_detail', dict(author_dict, slug_field='full_name')),
	(r'^books/$', 'django.views.generic.list_detail.object_list', book_dict),
	(r'^books/isbn/(?P<slug>\d+)/$', 'django.views.generic.list_detail.object_detail', dict(book_dict, slug_field='isbn_10')),
	(r'^papers/$', 'django.views.generic.list_detail.object_list', paper_dict),
	(r'^papers/doi/(?P<slug>\s?(10\.\d{4}\/\S+))/$', 'django.views.generic.list_detail.object_detail', dict(paper_dict, slug_field='doi')),
)
